package com.atguigu.demo.customer.mapper;

import com.atguigu.demo.customer.bean.Customer;
import com.baomidou.dynamic.datasource.annotation.DS;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper  //标识数据层组件
@DS("mysql0519")
public interface CustomerMapper extends BaseMapper<Customer> {
   //#{} 会判断参数类型 如果是string类型会自动帮你补上单引
    @Insert("insert into customer values(#{cust.id},#{cust.name},#{cust.age} ) ")
    @DS("mysql2021")
    public void   insertCustomer(@Param("cust") Customer customer);

    @Select("select id ,name,age from customer where id =#{customerId}")
    public  Customer    selectCustomerById(@Param("customerId") Long customerId);

    @Select("select from  where ")
    public List<Customer> selectCustomer(@Param("customer") Customer customer);

    public void  delCustomer(@Param("customer") Customer customer);

    public  void   updateCustomer(@Param("customer") Customer customer);
}
